/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui.admin;

import ui.user.*;
import hibernate.entity.Accounts;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import ui.admin.course.CourseManager;
import ui.common.AbstractUIBean;

/**
 *
 * @author Neo
 */
@ManagedBean
@RequestScoped
public class AbstractAdminBean extends AbstractUIBean {

    /**
     * Creates a new instance of AbstractUserBean
     */
    int roleID = 3;
    Accounts acc;

    public AbstractAdminBean() {
    }

    public void isAuthor() {
        HttpServletRequest req = getRequest();
        if (req.getSession().getAttribute("currAcc") == null) {
            HttpServletResponse response = getRespond();
            try {
                response.sendRedirect(req.getContextPath()+"/user/personal/login.xhtml");
            } catch (IOException ex) {
                Logger.getLogger(CourseManager.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
  
}
